<template>
  <div>
    <a-card :bordered="false">
      <f-table ref="table" rowKey="orderId" :columns="columns"  :multiple="true" :operator="operator" :params="queryParam" :api="api.order">
        <span slot="action" slot-scope="text, record">
          <template>
            <a @click="$refs.drawer.showDrawer(record)">编辑</a>
            <a-divider type="vertical"/>
          </template>
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
            <a-menu slot="overlay">
              <a-menu-item v-if="$auth('table.delete')">
                <a href="javascript:;" @click="$refs.table.del(record)">删除</a>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
      </f-table>
      <order-drawer ref="drawer"></order-drawer>
    </a-card>
  </div>
</template>
<script>
  import orderDrawer from './order_drawer.vue'
  import api from './js/api'
  export default {
    name: 'TableList',
    components: {
      orderDrawer
    },
    data() {
      let me = this
      //操作按钮
      let operator = []
      operator.push({
        name: '添加',
        icon: 'plus',
        that: this,
        handler: function(table, that) {
            that.$refs.drawer.showDrawer()
        }
      })
      operator.push({
        name: '删除',
        icon: 'delete',
        batch: true,
        handler: function(table) {
            table.remove()
        }
      })
      return {
        api:  Object.assign(api, this.api),
        //列表初始化查询参数
        queryParam: {},
        // 表头
        columns: [
          {
            title: '#',
            width: '60',
            align: 'center',
            customRender: (text, record, index) => index + 1
          },
          {
            title: '订单编号',
            align: 'center',
            dataIndex: 'orderNo'
          },
          {
            title: '下单人',
            align: 'center',
            dataIndex: 'accountInfoId'
          },
          {
            title: '支付类型（PAY_WX微信  PAY_ALI支付宝 3线下PAY_UNDERLINE 4 PAY_BALANCE余额支付）',
            align: 'center',
            dataIndex: 'payType'
          },
          {
            title: '订单状态（1待付款，2已付款,3已退款）',
            align: 'center',
            dataIndex: 'orderStatus'
          },
          {
            title: '',
            align: 'center',
            dataIndex: 'buySource'
          },
          {
            title: '用户备注',
            align: 'center',
            dataIndex: 'remark'
          },
          {
            title: '订单总金额',
            align: 'center',
            dataIndex: 'totalPrice'
          },
          {
            title: '验证码',
            align: 'center',
            dataIndex: 'orderCode'
          },
          {
            title: '如果支付方式为线下  是否确认（1已确认，2未确认）',
            align: 'center',
            dataIndex: 'isCheck'
          },
          {
            title: '推荐人Id同员工Id同accountId',
            align: 'center',
            dataIndex: 'employeeId'
          },
          {
            title: '过期时间',
            align: 'center',
            dataIndex: 'expireDate'
          },
          {
            title: '线下支付（销售人员收款验证时选择）',
            align: 'center',
            dataIndex: 'paywayId'
          },
          {
            title: '支付时间',
            align: 'center',
            dataIndex: 'payDate'
          },
          {
            title: '',
            align: 'center',
            dataIndex: 'airportId'
          },
          {
            title: '支付参数',
            align: 'center',
            dataIndex: 'payparamId'
          },
          {
            title: '支付入口',
            align: 'center',
            dataIndex: 'payEntranceType'
          },
          {
            title: '',
            align: 'center',
            dataIndex: 'isEnd'
          },
          {
            title: '',
            align: 'center',
            dataIndex: 'refundRemark'
          },
          {
            title: '是否处理',
            align: 'center',
            dataIndex: 'isDeal'
          },
          {
            title: '删除状态',
            align: 'center',
            dataIndex: 'delState'
          },
          {
            title: '',
            align: 'center',
            dataIndex: 'weChatId'
          },
          {
            title: '易宝订单token,再次调取支付时用到',
            align: 'center',
            dataIndex: 'yiBaoOrderToken'
          },
          {
            title: '',
            align: 'center',
            dataIndex: 'yiBaoUniqueOrderNo'
          },
          {
            title: '电子签名Id',
            align: 'center',
            dataIndex: 'accountElesignId'
          },
          {
            title: '订单来源',
            align: 'center',
            dataIndex: 'sourceType'
          },
          {
            title: '回调地址',
            align: 'center',
            dataIndex: 'goodsCallbackUrl'
          },
          {
            title: '回调地址',
            align: 'center',
            dataIndex: 'goodsStateCallbackUrl'
          },
          {
            title: '',
            align: 'center',
            dataIndex: 'isCallbackSuccess1'
          },
          {
            title: '',
            align: 'center',
            dataIndex: 'isCallbackSuccess2'
          },
          {
            title: '公司下单时用户的唯一标识',
            align: 'center',
            dataIndex: 'thirdMemberId'
          },
          {
            title: '生成物品的起始日期,计算有效期用',
            align: 'center',
            dataIndex: 'flightDate'
          },
          {
            title: '',
            align: 'center',
            dataIndex: 'createDate'
          },
          {
            title: '操作',
            align: 'center',
            scopedSlots: { customRender: 'action' }
          }
        ],
        operator: operator
      }
    },
    created() {
    },
    methods: {
    }
  }
</script>
